<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- <script src="./lib/echarts.min.js"></script> -->
  <script src="https://cdn.jsdelivr.net/npm/echarts@4.7.0/dist/echarts.min.js"></script>
  <style>
    section {
      border: 3px solid pink;
    }
  </style>
</head>

<body>
  <div style="width: 600px;height: 400px"></div>

  <script>
    const chartDom = document.querySelector('div')
    const chart = echarts.init(chartDom)

    var xDataArr = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
    var yDataArr = [3000, 2800, 900, 1000, 800, 700, 1400, 1300, 900, 1000, 800, 600]

    const option = {
      xAxis: {
        type: 'category',
        data: xDataArr
      },
      yAxis: {
        type: 'value'
      },
      series: [{
        name: 'hhaha',
        type: 'bar',
        data: yDataArr,
        markPoint: {
          data: [{
              type: 'max',
              name: '最大值'
            },
            {
              type: 'min',
              name: '最小值'
            }
          ]
        },
        markLine: {
          data: [{
            type: 'average',
            name: '平均值'
          }]
        },
        markArea: {
          data: [
            [{
                xAxis: '1月'
              },
              {
                xAxis: '3月'
              }
            ],
            [{
                xAxis: '8月'
              },
              {
                xAxis: '9月'
              },
            ]
          ]
        },
        showBackground: true,
        backgroundStyle: {
          color: '#ccc'
        },
        itemStyle: {
          color: '#6cc'
        }
      }],
      toolbox: {
        feature: {
          magicType: {
            type: ['bar', 'line']
          }
        }
      },

    }

    chart.setOption(option)
  </script>
</body>

</html>